﻿using System;

namespace StockAnalyst2.StockGrid
{
	internal class CellTimeSpanVM : CellVM
	{
		#region Attributes

		private TimeSpan? _value;
		private bool _isRising;

		#endregion

		#region Properties

		public TimeSpan? Value
		{
			get
			{
				return _value;
			}
			set
			{
				if (_value != value)
				{
					if (_value != null)
					{
						base.IsNotFirstValue = true;

						if (_value < value)
						{
							this.IsRising = true;
						}
						else if (_value > value)
						{
							this.IsRising = false;
						}
					}

					_value = value;
					base.OnPropertyChanged("Value");
				}
			}
		}

		public bool IsRising
		{
			get
			{
				return _isRising;
			}
			set
			{
				if (_isRising != value)
				{
					_isRising = value;
					base.OnPropertyChanged("IsRising");
				}
			}
		}

		#endregion

	}
}
